import { createApp, ref } from 'vue'
import Notice from '@/components/NoticeTop.vue'
export function showNotice(options) {
  const visible = ref(true)
  const noticeInstance = createApp(Notice, {
    visible,
    ...options
  })
  const container = document.createElement('div')
  noticeInstance.mount(container)
  console.log('container', container)
  document.body.appendChild(container)
  const destroy = () => {
    visible.value = false
    document.body.removeChild(container)
    noticeInstance.unmount()
  }
  setTimeout(() => {
    destroy()
  }, 1500);
  return {
    destroy: destroy,
  }
}
